import { create } from 'zustand'
import { createJSONStorage, persist } from 'zustand/middleware'
import UserBaseInfoDto from '@/core/account/types/model/dto/UserBaseInfoDto'
import globalConfig from '@/core/framework/config/globalConfig'

const useAccountBaseInfoStore = create(
	persist<UserBaseInfoDto>(
		(setState, getState) => {
			return {} as UserBaseInfoDto
		},
		{
			name: `${globalConfig.storageKeyPrefix}.account.base.info`,
			storage: createJSONStorage(() => localStorage),
		},
	),
)

export default useAccountBaseInfoStore
